package center.leon.zoofeignsentinelapi.common;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @author : Leon on XXM Mac
 * @since : create in 2024/8/19 11:17
 */
@Slf4j
@Data
public class Response<T> {
    private int code;
    private String msg;
    private T data;

    public Response(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Response success(T data) {
        return new Response(200, "success", data);
    }

    public static Response error(int code, String msg) {
        return new Response(code, msg, null);
    }
}
